#ifndef __APC_KEY_FUNCTION_H_
#define __APC_KEY_FUNCTION_H_

#include "at32project_header.h"

#define USER_VOL_DOWN       BTN1_MSK
#define USER_VOL_UP         BTN2_MSK
#define USER_FUNC_KEY       BTN3_MSK
#define USER_MODE_KEY       BTN4_MSK


typedef int32_t (*key_process_t)(uint32_t p);

#define KEY_RET_CODE_NONE   (0x00)
#define KEY_RET_CODE_STOP   (0x01)



typedef struct 
{
    uint32_t key;
    uint16_t hid;

    uint8_t double_ps : 1;
    uint8_t long_ps : 1;

    uint8_t double_count : 2;  
    uint8_t long_bit : 2;
    
    TimerHandle_t func_timer;

}key_value_t;


typedef struct 
{
    uint32_t param;
    key_process_t key_process;
}key_msg_t;


void apc_key_scan_create(void);

void key_short_func_register(key_process_t function);
void key_double_func_register(key_process_t function);
void key_long_func_register(key_process_t function);

#endif
